//
//  CTReleasedHeaderView.m
//  digitalCurrency
//
//  Created by 默认账户 on 2019/6/6.
//  Copyright © 2019 XinHuoKeJi. All rights reserved.
//

#import "CTReleasedHeaderView.h"

@interface CTReleasedHeaderView ()

@end

@implementation CTReleasedHeaderView

- (instancetype)initWithFrame:(CGRect)frame
    {
        self = [super initWithFrame:frame];
        if (self) {
            [self createviews];
        }
        return self;
    }
    
- (void)createviews {
    
    NSArray *titles = @[LocalizationKey(@"The remaining amount to be released"),LocalizationKey(@"Static released"),LocalizationKey(@"Share released"),LocalizationKey(@"Products to be snapped up today"),LocalizationKey(@"Products already snapped up today"),LocalizationKey(@"Total products snapped up")];
    NSArray *numbers = @[@"0.00 MOS",@"0.00 MOS",@"0.00 MOS",@"0.00 MOS",@"0.00 MOS",@"0.00 MOS"];
    
    UIView *topview = [[UIView alloc] init];
    topview.backgroundColor = [UIColor colorWithHEX:mainBlackColor];
    topview.layer.cornerRadius = 5;
    [self addSubview:topview];
    [topview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(12);
        make.right.mas_equalTo(-15);
        make.height.mas_equalTo(20+30*titles.count);
    }];
   
    for (int i = 0; i < titles.count; i++) {
        UILabel *title  = [[UILabel alloc] init];
        title.textColor = [UIColor whiteColor];
        title.text = titles[i];
        title.font = [UIFont boldSystemFontOfSize:16];
        [topview addSubview:title];
        [title mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(12);
            make.top.mas_equalTo(16 + i * 30);
            make.height.mas_equalTo(20);
        }];
        
        
        UILabel *countLabel  = [[UILabel alloc] init];
        countLabel.textColor = [UIColor whiteColor];
        countLabel.textAlignment = NSTextAlignmentRight;
        countLabel.text = numbers[i];
        if (i == 0) {
            self.firstLabel = countLabel;
        }
        else if (i == 1) {
            self.secodLabel = countLabel;
        }
        else if (i == 2) {
            self.thirdLabel = countLabel;
        }
        else if (i == 3) {
            self.forthLabel = countLabel;
        }
        else if (i == 4) {
            self.fifthLabel = countLabel;
        }
        else{
            self.sixLabel = countLabel;
        }
        
        countLabel.font = [UIFont boldSystemFontOfSize:16];
        [topview addSubview:countLabel];
        [countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.mas_equalTo(-12);
            make.top.mas_equalTo(16 + i * 30);
            make.height.mas_equalTo(20);
        }];
        
    }

}

@end
